home *** CD-ROM | disk | FTP | other *** search
- /*************************************************************************
- *
- * WOptionButton -- Wrapper for the option button control.
- *
- * Events:
- *
- * DataAvailable --
- *
- * DataClose --
- *
- * DataOpen --
- *
- * DataRequest --
- *
- *************************************************************************/
-
- #ifndef _WOPTBTTN_HPP_INCLUDED
- #define _WOPTBTTN_HPP_INCLUDED
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma pack(push,8);
- #pragma enum int;
- #endif
-
- #ifndef _WBUTTON_HPP_INCLUDED
- # include "wbutton.hpp"
- #endif
- #ifndef _WDATATRG_HPP_INCLUDED
- # include "wdatatrg.hpp"
- #endif
-
- class WDataSource;
-
- class WCMCLASS WOptionButton : public WButton {
-
- WDeclareSubclass( WOptionButton, WButton )
-
- public:
-
- /******************************************************
- * Constructors and Destructors
- ******************************************************/
-
- WOptionButton();
-
- ~WOptionButton();
-
- /******************************************************
- * Properties
- ******************************************************/
-
- // Checked
- //
- // Set/get whether the option button is checked or not.
- // TRUE means its state is WBStateChecked, FALSE
- // means it is WBStateNotChecked.
- // If toggleOthersInGroup is TRUE and checked is TRUE,
- // will set the state of all other option buttons in
- // the group to WBStateNotChecked.
-
- WBool GetChecked() const;
- WBool SetChecked( WBool checked, WBool toggleOthersInGroup=TRUE );
-
- // DataColumns
-
- WString GetDataColumns() const;
- WBool SetDataColumns( const WString & cols );
-
- // DataSource
-
- WDataSource *GetDataSource() const;
- WBool SetDataSource( WDataSource *source );
-
- // DataValueChecked
-
- WString GetDataValueChecked() const;
- WBool SetDataValueChecked( const WString & val );
-
- // FDXDataSource
-
- WBool SetFDXDataSource( WULong * fdxDataSource,
- WULong fdxOnValue=TRUE );
-
- // State
- //
- // Set/get the state.
-
- WButtonState GetState( WBool getAllStates=FALSE ) const;
- WBool SetState( WButtonState state );
-
- /******************************************************
- * Methods
- ******************************************************/
-
- // CheckGroup
- //
- // Specify the window ID of the first and last option button that
- // the current option button is a member of. The function then
- // checks the current option button and ensures that all other
- // option buttons in that group are unchecked.
-
- WBool CheckGroup( WUInt firstWindowID, WUInt lastWindowID );
-
- // Toggle
- //
- // Toggles the state, returning the new state (notset or set).
-
- WButtonState Toggle();
-
- // WhichChecked
- //
- // Returns a pointer to the option button in the group that
- // is checked, if any.
-
- WOptionButton *WhichChecked() const;
-
- // WhichCheckedID
- //
- // Like WhichChecked, but instead returns the ID of the
- // button that was checked. Returns 0 if no button was
- // checked.
-
- WInt WhichCheckedID() const;
-
- /******************************************************
- * Overrides
- ******************************************************/
-
- virtual WColor GetBackColor( WBool getResultingColor=TRUE ) const;
-
- virtual WBool AutoSize();
-
- virtual WBool CloneWindow( WStyle newStyle, WStyle newExStyle,
- void * data=NULL );
-
- virtual const WChar * InitializeClass();
-
- virtual WStyle GetDefaultStyle() const;
-
- virtual WBool FDXIn();
-
- virtual WBool FDXOut();
-
- virtual WBool ProcessCommand( WUInt id, WNotify code,
- WNotifyInfo info, WLong & returns );
-
- WBool DataOpenHandler( WOptionButton *, WDataOpenEventData *ev );
- WBool DataCloseHandler( WOptionButton *, WDataCloseEventData *ev );
- WBool DataAvailableHandler( WOptionButton *, WDataAvailableEventData *ev );
- WBool DataRequestHandler( WOptionButton *, WDataRequestEventData *ev );
-
- protected:
-
- WBool AllocDTCell();
-
- /******************************************************
- * Data members
- ******************************************************/
-
- protected:
-
- WULong *_fdxDataSource;
- WULong _fdxOnValue;
- WDataTargetBoolCell *_dataTarget;
- WBool _initial;
- WBool _wasEnabled;
- };
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma enum pop;
- #pragma pack(pop);
- #endif
-
- #endif // _WOPTBTTN_HPP_INCLUDED
-